<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" placeholder="请输入较大数" id="big">
<input type="text" placeholder="请输入较小数" id="small">
<input type="button" value="点击运行" id="compute"  >
</body>
<script>
    function value(){
        let big = document.getElementById("big").value;
        let small = document.getElementById("small").value;
        let r=0;
        while (true){
            if((big%small)==0){
                alert(small);
                return;
            }else {
                r=small;
                small=big%small;
                big=r;
            }
        }
    };
    document.getElementById("compute").addEventListener('click',function () {
        value();
    },false);
</script>
</html>